<link rel="stylesheet" type="text/css" href="<?php echo Yii::app()->request->hostInfo; ?>/css/trip.css?v=<?php echo Yii::app()->params['version']['CSS'];?>"/>
<link rel="stylesheet" type="text/css" href="<?php echo Yii::app()->request->hostInfo; ?>/css/pikaday.css?v=<?php echo Yii::app()->params['version']['CSS'];?>"/>
<div class="banner">
	<div class="wrap">
    	<div class="reserve">
        	<h3><span>已有<?php echo $produce['sale_num'];?>人购买</span>￥<?php echo $produce['price'];?>/<?php echo $produce['unit'];?></h3>
            <p><?php echo $produce['goods_sub'];?></p>
            <ul>
            	<li>
                	<span>人数:</span>
                    <div class="select fl">
                        <p><input type="text" name="person" id="person" class="info" maxlength="3" value="1"/><i></i></p>
                        <ul class="item">
                            <li data-val="1">1</li>
                            <li data-val="2">2</li>
                            <li data-val="3">3</li>
                            <li data-val="4">4</li>
                            <li data-val="5">5</li>
                        </ul>
                    </div>
                </li>
            	<li>
                	<span>出发日期:</span>
                    <div class="data fl">
                    	<input type="text" name="date" id="datepicker" readonly="readonly" value="<?php echo date("Y-m-d",strtotime("+3 day"));?>" />
                        <i></i>
                    </div>
                </li>
                <li>
                	<span></span>
                	<!--<strong><input type="checkbox" name="confirm" id="rem" /><label for="rem">还没确定日期</label></strong>-->
                </li>
            </ul>
            <a href="javascript:void(0);" class="buy">立即预定</a>
        </div>
    </div>
    <div class="silder" data-switch="off" data-height="520">
    	<div class="item" data-url="<?php echo $produce['detail_image'];?>"></div>
    </div>
</div>
<div class="cont">
	<div class="buy_pro">
    	<h2>产品购买流程<i>自由行管家服务让你全程无忧</i></h2>
        <dl>
        	<dt></dt>
        	<dd><i class="ico_1"></i><span>选行程</span></dd>
        	<dd><i class="ico_2"></i><span>下订单</span></dd>
        	<dd><i class="ico_3"></i><span>订单支付</span></dd>
        	<dd><i class="ico_4"></i><span>完成支付</span></dd>
        	<dd><i class="ico_5"></i><span>接受管家服务</span></dd>
        	<dd><i class="ico_6"></i><span>出&nbsp;&nbsp;行</span></dd>
        </dl>
    </div>
    <div class="trip_nav_wrap">
    	<div class="trip_nav">
    		<li class="cur" data-go="trip_detail"><i></i>行程详情</li>
    		<li data-go="rate"><i></i>费用介绍</li>
    		<li data-go="notice"><i></i>注意事项</li>
    		<!--<li data-go="trip_faq"><i></i>问 答</li>
    		<li data-go="relevant"><i></i>相关产品</li>-->
    	</div>
    </div>
    <div class="trip_brief">
    	<div class="inc">
			<?php echo htmlspecialchars_decode($produce['goods_intro']);?>
    	</div>
        <!--<div class="res clrfix">
        	<h3>行程概要：</h3>
			<!--行程概要-->
            <!--<div class="main">
            	<i class="ico"></i>
            	<div class="line"></div>
                <?php foreach($dailyTrip as $key=>$value){?>
				<dl <?php if($key == 0){?>class="cur"<?php }?>>
                	<dt><i></i>DAY<span><?php echo $key + 1;?></span></dt>
                	<dd>
					<?php if(!empty($value['trip_pro'])){?>
						<?php $arr = json_decode($value['trip_pro']);?>
                    	<i></i>
						<?php foreach($arr as $v){?>
                    	<span><?php echo $v;?></span>
						<?php }?>
					<?php }else{?>
						<i></i>
                    	<span>暂无</span>
					<?php }?>
                    </dd>
                </dl>
				<?php }?>
            </div>
        </div>-->
    </div>
    <div class="trip_detail">
		<!--行程概要-->
    	<ul class="detail_nav">
			<?php foreach($dailyTrip as $key=>$value){?>
    	    <li <?php if($key == 0){?>class="cur"<?php }?>>
				<?php if(!empty($value['trip_pro'])){?>
					<?php $arr = json_decode($value['trip_pro']);?>
					<strong><i></i>第<?php echo $key + 1;?>天</strong>
					<?php foreach($arr as $v){?>
					<span><i></i><?php echo $v;?></span>
					<?php }?>
				<?php }else{?>
					<strong><i></i>第<?php echo $key + 1;?>天</strong>
					<span><i></i>暂无</span>
				<?php }?>
    	    </li>
			<?php }?>
    	</ul>
    	<div class="detail_info">
			<?php foreach($dailyTrip as $key=>$value){?>
    	    <div class="item">
    	        <h3><i></i><span>DAY<?php echo $key + 1;?></span><?php echo $value['trip_name'];?></h3>
    	        <!--酒店图片-->
				<div class="trip_slider">
                	<a href="javascript:void(0);" class="prev"></a>
                	<a href="javascript:void(0);" class="next"></a>
                	<ul>
						<?php $arr = json_decode($value['hotal_image']);?>
						<?php foreach($arr as $k=>$v){?>
                		<li><a href="javascript:;" style="cursor:default"><img src="<?php echo $v;?>" alt="" /></a></li>
						<?php }?>
                	</ul>
                </div>
				<!--酒店简介-->
    	        <dl class="brief">
    	            <dt><i class="ico ico_hotel"></i><?php echo $value['hotal'];?><span class="score"><?php for($i=0;$i<$value['hotal_start'];$i++){?><i></i><?php }?></span></dt>
    	            <dd><i class="ico ico_food"></i><?php echo $value['food'];?></dd>
					<?php if(!empty($value['spot'])){;?>
    	            <dd><i class="ico ico_spot"></i><?php echo $value['spot'];?></dd>
					<?php }?>
    	        </dl>
				<!--当地信息-->
    	        <ul class="info">
					<?php if(!empty($value['guide'])){;?>
    	            <li><i class="ico ico_guide"></i>司导：<?php echo $value['guide'];?></li>
					<?php }?>
					<?php if(!empty($value['traffic'])){;?>
    	            <li><i class="ico ico_traffic"></i>当地交通：<?php echo $value['traffic'];?></li>
					<?php }?>
					<?php if(!empty($value['feature'])){;?>
    	            <li><i class="ico ico_feature"></i>特色项目：<?php echo $value['feature'];?></li>
					<?php }?>
    	        </ul>
				<!--详情信息-->
    	        <div class="detail">
    	            <?php echo $value['detail'];?>
    	        </div>
    	    </div>
			<?php }?>
    	</div>
    </div>
</div>
<div class="cont">
	<!--当地特色-->
	<!--<?php $this->beginWidget('application.widget.produce.character'); ?>
	<?php $this->endWidget(); ?>-->
</div>
<div class="cont">
	<div class="rate">
    	<?php echo htmlspecialchars_decode($produce['const_intro']);?>
    </div>
</div>
<div class="cont">
	<div class="notice">
    	<?php echo htmlspecialchars_decode($produce['attentions']);?>
    </div>
</div>
<!--<div class="cont">-->
	<!--问答模块-->
	<!--<?php $this->beginWidget('application.widget.tools.faq'); ?>
	<?php $this->endWidget(); ?>
</div>-->
<!--<div class="cont">-->
	<!--相关商品-->
	<!--<?php $this->beginWidget('application.widget.produce.similar'); ?>
	<?php $this->endWidget(); ?>
</div>-->
<script type="text/javascript" src="<?php echo Yii::app()->request->hostInfo; ?>/assets/js/pikaday.js"></script>
<script type="text/javascript" src="<?php echo Yii::app()->request->hostInfo; ?>/assets/js/trip.js"></script>
<script type="text/javascript">
$(".trip_brief .res .main dl").on("mouseenter mouseleave",function(event){
	$(this).addClass("cur",event.type == "mouseenter").siblings().removeClass("cur");
});

$(".feature li").on("mouseenter mouseleave",function(event){
	$(this).addClass("select",event.type == "mouseenter").siblings().removeClass("select");
});

var picker = new Pikaday({
	field: document.getElementById('datepicker'),
	firstDay: 1,
	minDate: new Date('<?php echo date("Y-m-d");?>'),
	maxDate: new Date('<?php echo date("Y-m-d", strtotime("+21 year"));?>'),
	yearRange: [<?php echo date("Y");?>,<?php echo date("Y", strtotime("+21 year"));?>]
});
var goodsn = "<?php echo $produce['goods_sn'];?>";

$(".buy").on("click", function(){
	var confirm = $("input[name=confirm]").is(':checked');
	var person = $("#person").val();
	var dateval = "待确认";
	person = (typeof person == "undefined")?1:person;
	if(confirm == false){
		dateval = $("input[name=date]").val();
	}
	var format = '{"produceId":"'+goodsn+'","quantity":'+person+',"dateval":"'+dateval+'"}';
	cookie.setCookie(goodsn, format);
	location.href = "<?php echo Yii::app()->createUrl('pay/index');?>&goodssn=" + goodsn;
});
function init_data(){
	var url = document.referrer;
	var format = cookie.getCookie(goodsn);
	if(url.indexOf('pay/index') != -1 && format != null){
		var json = eval("(" + format + ")");
		$("#datepicker").val(json.dateval);
		$("#person").val(json.quantity);
	}
}
init_data();
</script>